package com.anti.modular.bus.roomdeposit.service.impl;
import com.anti.jdbc.DBUtils;
import com.anti.modular.bus.roomdeposit.entity.LeaseDeposit;
import com.anti.modular.bus.roomdeposit.result.LeaseDepositResult;
import com.anti.modular.bus.roomdeposit.service.LeaseDepositService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


/**
 * 租約押金表service接口实现类
 *
 * @author anti
 * @date 2021-04-18 17:08:42
 */
@Service
public class LeaseDepositServiceImpl implements LeaseDepositService {
    @Resource
    DBUtils dbUtils;


    @Override
    public void addEntity(LeaseDeposit roomDeposit) {
        String s = dbUtils.insertKey(roomDeposit).toString();
        long l = Long.parseLong(s);
        roomDeposit.setId(l);
    }

    @Override
    public List<LeaseDeposit> getDepositListByLeaseId(Long roomId) {
        String sql="select a.* from bus_lease_deposit a where a.lease_id =? and a.status=0";
        List<LeaseDeposit> depositResults = dbUtils.query(sql, LeaseDeposit.class, roomId);
        return depositResults;
    }

}
